﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using pay.DAL;

/// <summary>
///VideoBiz 的摘要说明
/// </summary>
public class VideoBiz
{
    public VideoBiz()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }

    public List<VideoEnty> GetVideoList(int n)
    {
        List<VideoEnty> list = new List<VideoEnty>();

        try
        {
            DataTable dt = new DataTable();
            //SqlParameter[] para = new SqlParameter[1];
            //para[0] = new SqlParameter("@num", n);
             SqlConnection con=new SqlConnection(DBConn.Con_emweb_new);
            con.Open();
            string sql = "select top " + n + " v_id,classid,v_title,v_url,v_remark from dbo.web_video order by setup_date desc";
            dt = Emoney.DataAccess.SqlHelper.ExecuteDataset(con, CommandType.Text, sql, null).Tables[0];
            
           // dt = SQLHelper.ExecuteSet(SQLHelper.StrConn, CommandType.Text, sql, null).Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                VideoEnty et = new VideoEnty();
                et.v_id = OTO.ToInt(dt.Rows[i]["v_id"], 0);
                et.classid = OTO.ToInt(dt.Rows[i]["classid"], 0);
                et.v_title = OTO.ToStr(dt.Rows[i]["v_title"], "");
                et.v_url = OTO.ToStr(dt.Rows[i]["v_url"], "");
                et.v_remark = OTO.ToStr(dt.Rows[i]["v_remark"], "");
                list.Add(et);
            }
        }
        catch
        { }
        return list;
    }

}